<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
    window.onload = function () {
        
   
    //获取body标签
    var body = document.body;
    console.log(body);
    //获取HTML标签
    var html = document.documentElement;
    console.log(html)
    //获取页面中的所有元素
    var all = document.all;  
    for(var i = 0 ; i < all.length ; i++){
        console.log(all[i]);
    }
    //根据元素的class属性获的一组元素的节点对象,ie8以下不支持该属性
    var div = document.getElementsByClassName("box1");
    console.log(div);
    //通过css选择器来获取
    var div = document.querySelector(".box1 div");
    console.log(div.innerText);
    //获取所有div
    var demo = document.querySelectorAll("div");
    console.log(demo);
    }
</script>
<body>
    <div class="box1">
        <div>2233</div>
    </div>  
    <div></div>  
</body>
</html>